Skip to content

feat(dnd): tear-off window matches pane size and grab position#310

Open
AgentA-asaf wants to merge 6 commits intomainfrom
agenta/fix-devtools-secondary
Open

feat(dnd): tear-off window matches pane size and grab position#310
AgentA-asaf wants to merge 6 commits intomainfrom
agenta/fix-devtools-secondary

Conversation

@AgentA-asaf
Copy link
Copy Markdown
Contributor

Summary

When a pane is torn off into a new window, the new window is now sized to match the pane's on-screen dimensions and positioned so the cursor lands at the same relative point within the window as it was within the pane when the drag started.

Before: New window was always 1200×800, centered on cursor horizontally with a fixed 16px title-bar offset.

After: New window matches the pane's pixel dimensions (min 400×300). The cursor lands at the exact grab point — if you grabbed the pane near the top-left, the window appears top-left of the cursor; if you grabbed near the center, the window centers on it.

Changes

File Change
frontend/layout/lib/TileLayout.win32.tsx Capture paneRect (screen coords) and grabOffset in onDragStart via getBoundingClientRect
frontend/app/drag/CrossWindowDragMonitor.win32.tsx Add paneRect/grabOffset to DragItemPayload; forward through performTearOff → openWindowAtPosition
frontend/app/drag/CrossWindowDragMonitor.tsx + .platform.tsx Export PaneRect, GrabOffset types
frontend/types/custom.d.ts Extend openWindowAtPosition signature (optional width, height, grabOffsetX, grabOffsetY)
frontend/util/cef-api.ts Pass new optional fields to IPC
agentmux-cef/src/commands/drag.rs Use passed dimensions (min 400×300); position from grab offset; falls back to 1200×800/top-center for tab tearoff or missing data

Fully backward-compatible — all new fields are optional with safe fallbacks.

Test plan

  • Tear off a small pane from a split layout → new window matches the pane's size
  • Tear off a large pane → new window matches
  • Cursor lands at the grab point after tear-off (no jump to center)
  • Tab tear-off still works (falls back to 1200×800)
  • Minimum size clamp: very small panes (< 400×300) get a usable window

🤖 Generated with Claude Code

AgentA and others added 6 commits April 6, 2026 22:43
29 commands across 5 categories (open, split, window, tab, pane, dev).
Agents/MCP can invoke any command programmatically via the run_command
IPC endpoint without opening the UI.

- frontend/app/store/command-registry.ts: CommandRegistry singleton,
  registerDefaultCommands(), agentmux-run-command event listener
- frontend/app/modals/command-palette.tsx: SolidJS overlay with fuzzy
  search, arrow key nav, Enter to execute, Escape to dismiss
- frontend/app/modals/command-palette.scss: palette styles
- frontend/app/store/keymodel.ts: Ctrl+P → opens palette
- frontend/app/modals/modalregistry.tsx: registers CommandPaletteModal
- frontend/wave.ts: calls registerDefaultCommands() at init
- agentmux-cef/src/commands/palette.rs: run_command handler, dispatches
  agentmux-run-command CustomEvent to target browser window
- agentmux-cef/src/commands/mod.rs: pub mod palette
- agentmux-cef/src/ipc.rs: "run_command" route arm

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
New window is sized to match the torn-off pane's on-screen dimensions
and positioned so the cursor lands at the same relative point within
the window as it was within the pane when the drag started.

- TileLayout.win32.tsx: capture paneRect (screen coords) and grabOffset
  (cursor offset within pane) in onDragStart via getBoundingClientRect
- DragItemPayload: add optional paneRect + grabOffset fields
- CrossWindowDragMonitor.win32.tsx: forward paneRect/grabOffset through
  performTearOff → openWindowAtPosition
- CrossWindowDragMonitor.tsx/.platform.tsx: export PaneRect, GrabOffset types
- custom.d.ts + cef-api.ts: extend openWindowAtPosition with width,
  height, grabOffsetX, grabOffsetY (all optional, backward-compatible)
- drag.rs: use passed dimensions (min 400×300); position from grab offset
  instead of hardcoded center+16px; falls back to 1200×800 / top-center
  if frontend doesn't provide size (e.g. tab tearoff)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@reagentx-workflow reagentx-workflow Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReAgent Diagnostics
Field Value
ReAgent Version 5.12.5
Trigger PR opened
Project Context CLAUDE.md loaded
Model claude-opus-4-6
Effort high
Ref Repos Disabled
Merge Analysis Clean
Review Time 209.5s
Timestamp 2026-04-07T06:43:24Z
Repository agentmuxai/agentmux
PR #310

LGTM

AgentA-asaf pushed a commit that referenced this pull request Apr 13, 2026
- specs/SPEC_CONSOLIDATE_FORGE_IDENTITY_INTO_AGENT_2026_04_13.md:
  Commit the forge+identity consolidation spec alongside its four
  merged PRs (#363-#366).

- specs/per-pane-process-tree-metrics.md:
  Commit previously-untracked per-pane metrics draft (v0.32.74 era).

- docs/analysis/pane-tearoff-bug-status-2026-04-07.md:
  Move TEAROFF-BUG-STATUS.md (root scratch note) into docs/analysis/
  where tear-off investigation docs already live. Related to open
  PR #310.

- docs/archive/: new directory for stale session artifacts
  - HANDOFF-2026-03-31, 2026-04-02 (x2), 2026-04-03, 2026-04-04,
    2026-04-08 — session hand-off snapshots, all stale
  - NEXT-2026-04-04 — day-ahead plan from last month
  - REPORT-2026-04-03-status, REPORT-v0.33.26 — point-in-time reports
  - CRASH-DUMP-ANALYSIS-2026-03-26 — one-time investigation
  - CEF-VERSION-REPORT-2026-04-03 — version snapshot

- docs/retro → docs/retros: merge singleton dir into plural dir
  (raw-browser-on-launch.md).

- docs/spec → docs/specs: merge singleton dir into plural dir
  (process-state-tracker.md), plus docs/spec-dead-code-removal.md
  moved to docs/specs/dead-code-removal.md.

bump: 0.33.128 -> 0.33.129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant